package com.dream.dao.order;

/**
 * 
 * @author Evan
 * @date 2013-8-25
 * 
 */
import org.springframework.stereotype.Repository;

import com.dream.model.order.OrderCustomerProduct;
import com.dream.utils.hibernate.DetachedCriteriaBuilder;
import com.dream.utils.hibernate.DreamBaseDAO;

@Repository
public class OrderCustomerProductDAO extends DreamBaseDAO<OrderCustomerProduct> {
	
	public OrderCustomerProduct searchProduct(String productName,Long customerId){
		
		DetachedCriteriaBuilder builder = DetachedCriteriaBuilder.instance(OrderCustomerProduct.class);
		builder.innerJoin("product", "p").addEq("customerId", customerId).addEq("p.name", productName);
		//builder.leftJoin("p.createUserObj", "cu").leftJoin("p.updateUserObj", "uu");
		return this.selectTopOne(builder);
		
	}
	
}
